package ${modulePackage}.model;

import lombok.Data;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

@Data
public class IxUser implements Serializable {

    public IxUser() {
    }

    public IxUser(Integer id, String username, String email, String mobile, String name, String icon) {
        this.id = id;
        this.username = username;
        this.email = email;
        this.mobile = mobile;
        this.name = name;
        this.icon = icon;
    }

    /**
     * 用户ID
     */
    private Integer id;

    /**
     * 用户名
     */
    private String username;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 手机号
     */
    private String mobile;

    /**
     * 姓名
     */
    private String name;

    /**
     * 头像
     */
    private String icon;

    private boolean rootUser = false;
    private Set<String> roles;
    private Set<String> dataRoles;
    private Set<String> permissions;

    public static IxUser anonymousUser() {
        IxUser user = new IxUser();
        user.setId(0);
        user.setRoles(new HashSet<>());
        user.setPermissions(new HashSet<>());
        return user;
    }
}
